/* 
loader: 1 下载 2 使用（配置Loader）

plugins:1 下载 2 引用 3 使用
*/
const {
  resolve
} = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "main.js",
    path: resolve(__dirname, "build"),
  },
  module: {
    rules: [{
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
      {
        test: /\.less$/,
        use: ["style-loader", "css-loader", "less-loader"],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: "./src/index.html",
    }),
  ],
  mode: "development",
  devServer: {
    contentbase: resolve(__dirname, "build"),
    //启动gzip压缩
    compress: true,
    //设置端口号
    port: 3000,
    //自动打开浏览器默认的

  },
};